﻿using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace TestEFAbstractEntity.Entities
{
    public abstract class WorkNode
    {
        public event Action<WorkNode> OnEndApproval;
        public event Action<WorkNode> OnEndReject;

        public Guid Id { get; set; }
        public string Name { get; set; }
        public virtual WorkNode NextNode { get; set; }
        public StringBuilder Message { get; } = new StringBuilder();

        protected WorkNode() { }

        public void Approval()
        {
            Message.AppendLine("开始审批");
            OnEndApproval?.Invoke(this);
        }

        public void Reject()
        {
            Message.AppendLine("开始拒绝");
            OnEndReject?.Invoke(this);
        }
    }
}
